package class_and_object.exception;

import java.util.Scanner;

/**
 * @author haomin
 * @date 2022/04/29 15:22
 **/
public class demo1 {
    public static void main(String[] args){
        boolean flag = true;
        while (flag)
        try {
            Scanner in = new Scanner(System.in);
            int a = in.nextInt();
            int b = in.nextInt();
            if(b == 0){
                throw new ArithmeticException("除数不能为0");
            }
            System.out.println(a/b);
            flag = false;
        }catch (ArithmeticException e){
            System.out.println(e.getMessage());
            System.out.println("请重新输入：");
        }finally {
            System.out.println("finally 代码块");
        }
    }
}